<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="recording and transcoding system">
    <meta name="author" content="typefo">
    <link rel="icon" href="favicon.ico">
    <title>pbxMon System</title>
    <link type="text/css" rel="stylesheet" href="/css/bootstrap.min.css">
    <link type="text/css" rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <link type="text/css" rel="stylesheet" href="/css/report.css">
  </head>
  <body>
    <nav class="navbar navbar-default navbar-static-top">
      <div class="container">
        <div class="navbar-header">
          <a class="navbar-brand">
            <img alt="Brand" src="/img/logo.png" width="34" style="margin-top:-8px" />
          </a>
          <a class="navbar-brand">pbxMon</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li><a href="/cdr">通话记录</a></li>
            <li><a href="/server">网关管理</a></li>
            <li><a href="/route">路由管理</a></li>
            <li><a href="/interface">接口管理</a></li>
            <li><a href="/report">数据报表</a></li>
            <li><a href="/system/status">服务器状态</a></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="/system/option"><span class="glyphicon glyphicon-cog"></span> 系统设置</a></li>
            <li><a href="/logout"><span class="glyphicon glyphicon-log-out"></span> 退 出</a></li>
          </ul>
        </div>
      </div>
    </nav>
    <div class="container">
      <div class="row">
        <ol class="breadcrumb">
          <li><a href="/cdr">Home</a></li>
          <li><a href="/report">Report</a></li>
          <li class="active">Data</li>
          <li class="pull-right help"><span class="glyphicon glyphicon-question-sign"></span> <a href="#">帮助信息</a></li>
        </ol>
      </div>
      <div class="row">
        <table class="table table-hover table-condensed">
        	<thead><tr><th class="tab-left">#</th><th>网关名称</th><th>网关 IP 地址</th><th>呼入总数</th><th>呼出总数</th><th>总通话时长</th><th class="tab-right">平均通话时长</th></tr></thead>
          <tbody>
          <?php
          if ($data) {
            foreach ($data as $obj) {
              echo '<tr><td><span class="glyphicon glyphicon-dashboard"></span></td>';
              echo '<td>',$obj['name'],'</td>';
              echo '<td>',$obj['ip'],'</td>';
              echo '<td>',intval($obj['in']),'</td>';
              echo '<td>',intval($obj['out']),'</td>';
              $duration = intval($obj['duration']);
              if ($duration > 86400) {
                echo '<td>', intval($duration / 3600) , ':' , gmstrftime('%M:%S', $duration % 3600) ,'</td>';
              } else {
                echo '<td>', gmstrftime('%H:%M:%S',$duration) ,'</td>';
              }
              $avg = ($duration > 0) ? ($duration / intval($obj['out'])) : 0;
              echo '<td>',gmstrftime('%H:%M:%S',$avg),'</td></tr>',"\n";
            }
          }
          ?>
          </tbody>
        </table>
      </div>
    </div>
  </body>
  <script type="text/javascript" src="/js/jquery.min.js"></script>
  <script type="text/javascript" src="/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="/js/layer.js"></script>
</html>
